﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;

namespace Hxsoft.AppV1.Admin.UserManage.Controls
{
	public partial class ModifyNavigation : BaseUserControl
	{
		#region property
		/// <summary>
		/// 当前的导航项键值。
		/// </summary>
		public string CurrentKey
		{
			get { return NavigationBar.CurrentKey; }
			set { NavigationBar.CurrentKey = value; }
		}

		/// <summary>
		/// 用户名。
		/// </summary>
		public string UserName
		{
			get { return (string)ViewState["UserName"]; }
			set { ViewState["UserName"] = value; }
		}
		#endregion

		protected void Page_Load(object sender, EventArgs e)
		{
			if (!IsPostBack)
			{
				BindNavigationData();
				this.DataBind();
			}
		}

		protected void BindNavigationData()
		{
			string queryString = "?UserName=" + Server.UrlEncode(UserName);

			NavigationBar.NavigationItems.Add("UserExtendSetting", new OperationNavigationItem("基本信息", "~/UserManage/UserExtendSetting.aspx" + queryString));
			NavigationBar.NavigationItems.Add("ChangePassword", new OperationNavigationItem("修改密码", "~/UserManage/ChangePassword.aspx" + queryString));
			NavigationBar.NavigationItems.Add("UserSetting", new OperationNavigationItem("用户设置", "~/UserManage/UserSetting.aspx" + queryString));
			NavigationBar.NavigationItems.Add("RolesSetting", new OperationNavigationItem("隶属于", "~/UserManage/SetUserRoles.aspx" + queryString));			
		}
	}
}